/**
 * $Id: IOrganizationDao.java 6 2011-09-14 00:18:07Z adriftrock@gmail.com $
 */

package com.swehr.server.daos;

import com.swehr.server.models.Organization;

import java.util.List;

/**
 * @author Rock Huang
 * @version 0.1
 */
public interface IOrganizationDao {

    Organization findById(int id);

    List<Organization> find();

    List<Organization> findSubOrg(String parentId);

    void save(Organization org);

    void update(Organization org);

    boolean delete(int id);

    boolean signin(String email, String psw) throws Exception;

    /**
     * a batch Organizations need to save. ID should equal 0;
     *
     * @param orgs A list of Organizations needs to save.
     * @return boolean Return the operation is successful or not.
     * @throws Exception An exception will be throw if id > 0.
     */
    boolean batchSave(List<Organization> orgs) throws Exception;

    /**
     * a batch Organizations needs to update. ID should > 0.
     *
     * @param orgs A list of Organizations needs to update.
     * @return boolean Return the operation is successful or not.
     */
    boolean batchUpdate(List<Organization> orgs);

    boolean batchRemove(String[] removed);

    Organization findByEmailPsw(String email, String password);

    Organization findOrgRoot(String id);

    void linkOrgResource(String orgId, String website);
}
